<?php include("src/addEmpresarialDependiente_cs.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />

<title>Adicionar Recibo Empresa :: ASSC</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>

<link rel="stylesheet" type="text/css" media="all" href="includes/calendario/calendar-system.css" title="system" />
<script type="text/javascript" src="includes/calendario/calendar.js"></script>
<script type="text/javascript" src="includes/calendario/lang/calendar-es.js"></script>
<script type="text/javascript" src="includes/calendario/calendar-setup.js"></script>
	<script type="text/javascript" src="js/ajax.js"></script>
	<script type="text/javascript" src="js/ajax-dynamic-list-company.js"></script>
<script language="javascript" type="text/javascript">
	
	var displayRow = '';
	if (navigator.appName == "Netscape")
		displayRow = 'table-row';
	else if (navigator.appName.indexOf("Explorer") != -1) 
		displayRow = 'block';
	
	

	
	/**
	*	Función encargada de extraer la informacion de una etiqueta.
	*	@parameter: data->informacion que contiene una o varias etiquetas con información.
	*				lbl->etiqueta específica que contiene la infomación.
	*	@autor: jsl.
	*	@date: 12 AGO 2011	
	*/
	function getDataXML(data,label){				
		var label_open = '<'+label+'>';
		var label_close = '</'+label+'>';
		var inicio = data.indexOf(label_open);
		inicio += label_open.length;//la informacion esta desps de abrir la etiqueta
		var fin = data.indexOf(label_close);
		var result = data.substring(inicio,fin);//la info esta entre la etiqueta.
		return result;
	}
	
	function validate(action){
		document.getElementById("action").value = action;//1: save, 2: save and continue.
		
		var msg = '';
		var hdvc_code		= document.getElementById("country_hidden").value;
		var emde_periodo   = document.getElementById("emde_periodo").value;
			
		
		if(hdvc_code == '') 
			msg='- Por favor entre la compania. <br />';	
		
		if(emde_periodo == '') 
			msg='- Por favor entre el periodo de pago. <br />';
			
		
	
//		if(cli_email == '') 
//			msg='- Please enter the email. <br />';
//		else{
//			if ( ! isMail (cli_email) )
//				msg += '- Wrong email.<br />';
//		}
		
		

		if(msg==''){
			document.getElementById('form').submit();
			return true;
		}
		else{
			coolMessage("alert", msg);
			return false;
		}		
	}
	

	function onlyNumbers(e)
	{
	   var key;
	   if(window.event)
		  key = window.event.keyCode;   //IE
	   else
		  key = e.which;                //firefox
	   if (!( (key >= 48 && key <= 57) || key ==8 || key ==9 || key ==0 || key ==46 ))
		  return false;
	   else
		  return true;
	}	
	

$(document).ready(loadSalarioCompany());
function loadSalarioCompany()
{	
	var code = document.getElementById('country_hidden').value;
	$.ajax({
		type: "POST",
		url: "loadSalarioCompany.php",
		data: 'code='+code,
		success: function(msg)
		{	
			var salario = getDataXML(msg,"salario");		
			document.getElementById('div_salario').innerHTML = " $ "+salario;
			
			var resultadoArp = getDataXML(msg,"resultadoArp");		
			document.getElementById('res_salario_arp').innerHTML = resultadoArp;
			
			var resultadoNombreArp = getDataXML(msg,"arp");		
			document.getElementById('div_arp').innerHTML = resultadoNombreArp;
			document.getElementById('input_arp').value = resultadoArp;
			var porcARP = getDataXML(msg,"porcARP");		
			document.getElementById('div_porcARP').innerHTML = porcARP;
			
			var resultadoAfp = getDataXML(msg,"resultadoAfp");		
			document.getElementById('res_salario_afp').innerHTML = resultadoAfp;
			var resultadoNombreAfp = getDataXML(msg,"afp");		
			document.getElementById('div_afp').innerHTML = resultadoNombreAfp;
			document.getElementById('input_afp').value = resultadoAfp;
			var porcAFP = getDataXML(msg,"porcAFP");		
			document.getElementById('div_porcAFP').innerHTML = porcAFP; 
			
			var resultadoSena = getDataXML(msg,"resultadoSena");		
			document.getElementById('res_salario_sena').innerHTML = resultadoSena;
			var resultadoNombreSena = getDataXML(msg,"sena");		
			document.getElementById('div_sena').innerHTML = resultadoNombreSena;
			document.getElementById('input_sena').value = resultadoSena;
			var porcSena = getDataXML(msg,"porcSena");		
			document.getElementById('div_porcSena').innerHTML = porcSena; 
			
			var resultadoIcbf = getDataXML(msg,"resultadoIcbf");		
			document.getElementById('res_salario_icbf').innerHTML = resultadoIcbf;
			var resultadoNombreIcbf = getDataXML(msg,"icbf");		
			document.getElementById('div_icbf').innerHTML = resultadoNombreIcbf;
			document.getElementById('input_icbf').value = resultadoIcbf;
			var porcIcbf = getDataXML(msg,"porcIcbf");		
			document.getElementById('div_porcIcbf').innerHTML = porcIcbf; 
			
			var resultadoCaja = getDataXML(msg,"resultadoCaja");		
			document.getElementById('res_salario_caja').innerHTML = resultadoCaja;
			var resultadoNombreCaja = getDataXML(msg,"caja");		
			document.getElementById('div_caja').innerHTML = resultadoNombreCaja;
			document.getElementById('input_caja').value = resultadoCaja;
			var porcCaja= getDataXML(msg,"porcCaja");		
			document.getElementById('div_porcCaja').innerHTML = porcCaja; 
			
			var resultadoCompanyCode = getDataXML(msg,"company_code");		
			
			var resultadoNombreCompany = getDataXML(msg,"company_name");		
			
			var resultadoNombreCompanyNit = getDataXML(msg,"company_nit");		
			document.getElementById('div_company_nit').innerHTML = resultadoNombreCompanyNit;
			
			var resultadoCompanyAddress = getDataXML(msg,"company_address");		
			document.getElementById('div_company_address').innerHTML =  resultadoCompanyAddress;

			
			var resultadoNombreFuneral = getDataXML(msg,"funeral");		
			document.getElementById('div_funeral').innerHTML = resultadoNombreFuneral; 
	
			var resultadoAporte = getDataXML(msg,"aporte");
			document.getElementById('div_aporte').innerHTML =  resultadoAporte;
			document.getElementById('input_aporte').value =  resultadoAporte;
			var resultadoAdmin = getDataXML(msg,"admin");
			document.getElementById('div_admin').innerHTML =  resultadoAdmin;
			document.getElementById('input_admin').value =  resultadoAdmin;
			 var resultadoAdminIva = getDataXML(msg,"admin_iva");
			document.getElementById('div_admin_iva').innerHTML =  resultadoAdminIva;

			var resultadoIva = getDataXML(msg,"resultadoIva");
			document.getElementById('div_resultado_iva').innerHTML =  resultadoIva;
			document.getElementById('input_resultado_iva').value =  resultadoIva;
			var resultadoEps = getDataXML(msg,"resultadoEps");		
			document.getElementById('resultado_eps').innerHTML = resultadoEps;
			var resultadoNombreEps = getDataXML(msg,"eps");		
			document.getElementById('div_eps').innerHTML = resultadoNombreEps;
			document.getElementById('input_eps').value = resultadoEps;
			var porcEPS = getDataXML(msg,"porcEPS");		
			document.getElementById('div_porcEPS').innerHTML = porcEPS;
			
			
			var res_input_eps = 
			parseFloat(document.getElementById('input_eps').value) + 
			parseFloat(document.getElementById('input_arp').value) +
			parseFloat(document.getElementById('input_afp').value) +
			parseFloat(document.getElementById('input_sena').value) +
			parseFloat(document.getElementById('input_icbf').value) +
			parseFloat(document.getElementById('input_caja').value) +
			parseFloat(document.getElementById('input_aporte').value) +
			parseFloat(document.getElementById('input_admin').value) +
			parseFloat(document.getElementById('input_resultado_iva').value) +
			parseFloat(resultadoNombreFuneral) ;
			
			
			document.getElementById('input_eps').value = res_input_eps;
			document.getElementById('ajusteAnt').value = res_input_eps;
			document.getElementById('emde_admin').value = resultadoAdmin;

			document.getElementById('emde_funeral').value = resultadoNombreFuneral;
			document.getElementById('emde_name_eps').value = resultadoNombreEps;
			document.getElementById('emde_value_eps').value = resultadoEps;
			document.getElementById('emde_name_arp').value = resultadoNombreArp;
			document.getElementById('emde_value_arp').value = resultadoArp;
			document.getElementById('emde_name_afp').value = resultadoNombreAfp;
			document.getElementById('emde_value_afp').value = resultadoAfp;
			
			document.getElementById('emde_name_sena').value = resultadoNombreSena;
			document.getElementById('emde_value_sena').value = resultadoSena;
			document.getElementById('emde_name_icbf').value = resultadoNombreIcbf;
			document.getElementById('emde_value_icbf').value = resultadoIcbf;
			document.getElementById('emde_name_caja').value = resultadoNombreCaja;
			document.getElementById('emde_value_caja').value = resultadoCaja;

			document.getElementById('emde_aporte_mutual').value = resultadoAporte;
			document.getElementById('emde_admin').value = resultadoAdmin;
			document.getElementById('emde_admin_iva').value = resultadoIva;
			
			document.getElementById('emde_company_name').value = resultadoNombreCompany;
			document.getElementById('emde_company_nit').value = resultadoNombreCompanyNit;
			document.getElementById('emde_company_address').value = resultadoCompanyAddress;
			document.getElementById('hdvc_code').value = resultadoCompanyCode;

			

		}
		
		});
	
}


</script>
<style type="text/css">
	
	/* START CSS NEEDED ONLY IN DEMO */

	#mainContainer{
		width:660px;
		margin:0 auto;
		text-align:left;
		height:100%;
		background-color:#FFF;
		border-left:3px double #000;
		border-right:3px double #000;
	}
	#formContent{
		padding:5px;
	}
	/* END CSS ONLY NEEDED IN DEMO */
	
	
	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:175px;	/* Width of box */
		height:250px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #317082;	/* Dark green border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-size:12px;
		z-index:100;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;		
		padding:1px;
		cursor:pointer;
		font-size:12px;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */
		
	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#317082;
		color:#FFF;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:5;
	}
	
	form{
		display:inline;
	}
	
	</style>
</head>
<body>
<?php $item_select = 2;include("menu.php");?><br />
    <form name="form" id="form" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="addEmpresarialDependiente" id="addEmpresarialDependiente" value="1"/>
	<input type="hidden" name="action" id="action" value="1"/>
    <input type="hidden" name="hdvc_code" id="hdvc_code" />
	<input type="hidden" name="input_arp" id="input_arp" />
    <input type="hidden" name="input_afp" id="input_afp" />
    <input type="hidden" name="input_sena" id="input_sena" />
    <input type="hidden" name="input_icbf" id="input_icbf" />
    <input type="hidden" name="input_caja" id="input_caja" />
    <input type="hidden" name="ajusteAnt" id="ajusteAnt" />
    <input type="hidden" name="emde_admin" id="emde_admin" />
    <input type="hidden" name="input_aporte" id="input_aporte" />
	<input type="hidden" name="input_admin" id="input_admin" />
    <input type="hidden" name="emde_admin_iva" id="emde_admin_iva" />
    <input type="hidden" name="input_resultado_iva" id="input_resultado_iva" />
    
    <input type="hidden" name="emde_funeral" id="emde_funeral" />
    <input type="hidden" name="emde_name_eps" id="emde_name_eps" />
    <input type="hidden" name="emde_value_eps" id="emde_value_eps" />
    <input type="hidden" name="emde_name_arp" id="emde_name_arp" />
    <input type="hidden" name="emde_value_arp" id="emde_value_arp" />
    <input type="hidden" name="emde_name_afp" id="emde_name_afp" />
    <input type="hidden" name="emde_value_afp" id="emde_value_afp" />
    
    <input type="hidden" name="emde_name_sena" id="emde_name_sena" />
    <input type="hidden" name="emde_value_sena" id="emde_value_sena" />
    <input type="hidden" name="emde_name_icbf" id="emde_name_icbf" />
    <input type="hidden" name="emde_value_icbf" id="emde_value_icbf" />
    <input type="hidden" name="emde_name_caja" id="emde_name_caja" />
    <input type="hidden" name="emde_value_caja" id="emde_value_caja" />
    
    <input type="hidden" name="emde_aporte_mutual" id="emde_aporte_mutual" />
	<input type="hidden" name="emde_company_name" id="emde_company_name" />
    <input type="hidden" name="emde_company_nit" id="emde_company_nit" />
    <input type="hidden" name="emde_company_address" id="emde_company_address" />
	<input type="hidden" name="country_hidden"  id="country_hidden" />
    
    <div class="content_grv">
		<table width="90%" align="center" class="shadow">
            <tr>
                <td class="title">Informacion </td>
            </tr>
            <tr>
                <td>
                    <table class="tbl_form" align="center">
                        <tr>
                            <td class="title">SERVICIOS Y SOLUCIONES</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td align="right" class="title">RECIBO :</td>
                            <td>&nbsp;</td>
                            <td class="title"><?php echo $emde_receipt; ?></td>
                        </tr>
                        <tr>
                            <td><div><span class="lbl_gray">NIT : 900334306-7</span></div>
                            <div><span class="lbl_gray">CR 15 N.18-22 L3 ED.SOLIDARIDAD</span></div>
                            <div><span class="lbl_gray">TEL : 7440622</span></div></td>
                        </tr>
         </table>
           <table class="tbl_form" align="center" >             
                        
                        <tr>
                            <td align="left" width="10%"><span class="lbl_gray">Fecha Recibo:</span></td>
                            <td><?php echo $dateValue; ?>
			    </td>
                            <td>&nbsp;</td>
                            <td width="10%" align="right"><span class="lbl_gray">Periodo:</span></td>
                            <td width="10%"><input name="emde_periodo" type="text" style="width:100px" readonly="readonly" id="emde_periodo" maxlength="45" class="text_grv"/></td>
							<td align="left"><input name="imagea" type="image" id="calendar1" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <script type="text/javascript">
						Calendar.setup({
						inputField : "emde_periodo",							
						ifFormat : "%m/%Y",
						showsTime : false,
						button : "calendar1", 
						step : 1
						});
				</script>
                        </tr>
                        
                        <tr>
                            <td align="left" width="10%"><span class="lbl_gray">Compania :</span></td>
                            
                            <td><input type="text" id="country" name="country" value="" onkeyup="ajax_showOptions(this,'getCountriesByLetters',event)"  size="30" autocomplete="off"></td>
        					<td align="left"><input type="button" value="Procesar" onclick="javascript: loadSalarioCompany()" /> </td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td align="left"><span class="lbl_gray">Direccion :</span></td>
                            <td><div id="div_company_address"></div></td>
                            <td>&nbsp;</td>
                            <td><div>
                        	<input type="hidden" name="country_hidden"  id="country_hidden" maxlength="20"    />
                    </div></td>
                            <td>&nbsp;</td>
                            
                        </tr>
                        <tr>
                            <td align="left"><span class="lbl_gray">Nit :</span></td>
                            <td><div id="div_company_nit"></div></td>
                            <td>&nbsp;</td>
                            <td></td>
                            <td>&nbsp;</td>
                        </tr>
                        
                        <tr>
                            <td align="left"><span class="lbl_gray">Total Salarios :</span></td>
                            <td><div id="div_salario"></div></td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            
                        </tr>
                        <tr style="background-color:#808080">
                        	<td style="color:#FFFBF0" colspan="4">CONCEPTO</td>
							<td style="color:#FFFBF0" colspan="2">VALOR TOTAL</td>

                        </tr>
                        <tr>
                            <td align="left" colspan="2"><span class="lbl_gray">Aporte Admision:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td align="left"><input type="text" name="emde_value_admission" id="emde_value_admission" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td> 
                        </tr>
                        <tr style="background-color:#D2CCD2">
                            <td align="left"><span class="lbl_gray">Aporte EPS:</span></td>
                            <td><div id="div_eps"></div></td>
                            <td><div id="div_porcEPS"></div></td>
                            <td align="right">$</td>
                            <td align="left" colspan="2"><div id="resultado_eps"></div></td>
						</tr>
                        <tr>
                            <td align="left"><span class="lbl_gray">Aporte ARP:</span></td>
                            <td><div id="div_arp"></div></td>
                            <td><div id="div_porcARP"></div></td>
                            <td align="right">$</td>
                            <td align="left"><div id="res_salario_arp"></div></td>
                        </tr>
                       <tr style="background-color:#D2CCD2">
                            <td align="left"><span class="lbl_gray">Aporte AFP:</span></td>
                            <td><div id="div_afp"></div></td>
                            <td><div id="div_porcAFP"></div></td>
                            <td align="right">$</td>
                            <td align="left" colspan="2"><div id="res_salario_afp"></div></td>
                        </tr>
                        <tr>
                            <td align="left"><span class="lbl_gray">Aporte Sena:</span></td>
                            <td><div id="div_sena"></div></td>
                            <td><div id="div_porcSena"></div></td>
                            <td align="right">$</td>
                            <td align="left" colspan="2"><div id="res_salario_sena"></div></td>
                            
                        </tr>
                        <tr  style="background-color:#D2CCD2">
                            <td align="left"><span class="lbl_gray">Aporte ICBF:</span></td>
                            <td><div id="div_icbf"></div></td>
                            <td><div id="div_porcIcbf"></div></td>
                            <td align="right">$</td>
                            <td align="left" colspan="2"><div id="res_salario_icbf"></div></td>
                            
                        </tr>
                        <tr>
                            <td align="left" width="20%"><span class="lbl_gray">Aporte Caja Comp:</span></td>
                            <td><div id="div_caja"></div></td>
                            <td><div id="div_porcCaja"></div></td>
                            <td align="right">$</td>
                            <td align="left" colspan="2"><div id="res_salario_caja"></div></td>
 
                        <tr style="background-color:#D2CCD2">
                            <td align="left"colspan="2"><span class="lbl_gray">Aporte C. Reingreso :</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><input type="text" name="emde_reingreso" id="emde_reingreso" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td>
                        </tr>
                        <tr>
                            <td align="left"colspan="2"><span class="lbl_gray">Aporte Mutual:</span></td>
							<td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><div id="div_aporte"></div></td>
                        </tr>
                        <tr style="background-color:#D2CCD2">
                            <td  align="left" colspan="2"><span class="lbl_gray">Aporte Administracion:</span></td>
                             <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><div id="div_admin"></div></td>
                        </tr> 
                        <tr>
                            <td  align="left" colspan="2"><span class="lbl_gray">Aporte Administracion Iva:</span></td>
                            <td><div id="div_admin_iva"></div></td>
                            <td align="right">$</td>
                            <td colspan="2"><div id="div_resultado_iva"></div></td>
                        </tr>
                        <tr style="background-color:#D2CCD2">
                            <td align="left" colspan="2"><span class="lbl_gray">Aporte Otros:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><input type="text" name="emde_otros" id="emde_otros" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td>
                        </tr>                       
                        <tr>
                            <td align="left" colspan="2"><span class="lbl_gray">Aporte Servicios Funerarios:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><div id="div_funeral"></div> 
                            </td>
                        </tr>
 						<tr style="background-color:#D2CCD2">
                            <td align="left" colspan="2"><span class="lbl_gray">Aporte Ajustes:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><input type="text" name="emde_ajuste" id="emde_ajuste" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td>
                        </tr>
                        <tr>
                            <td align="left"colspan="2"><span class="lbl_gray">Aporte Interes Mora:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><input type="text" name="emde_interes_mora" id="emde_interes_mora" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td>
                        </tr>
                        <tr style="background-color:#D2CCD2">
                            <td align="left" colspan="2"><span class="lbl_gray">Descuentos:</span></td>
                            <td>&nbsp;</td>
                            <td align="right">$</td>
                            <td colspan="2"><input type="text" name="emde_descuentos" id="emde_descuentos" class="text_grv" size="21" maxlength="20" onKeyPress="return onlyNumbers(event)" onkeyup="javascript: ajustarFinal(this.value);"/></td>
                        </tr>
                        </table>
                        <table class="tbl_form" align="center" >
                        <tr style="background-color:#808080">
                            <td align="left" style="color:#FFFBF0" colspan="3" width="68%">TOTAL:</td>
							<td align="right" width="5%">$</td>
                            <td><input type="text" name="input_eps" id="input_eps" readonly="readonly" size="21"/></td>
                           
                        </tr>
                        
                        <tr>
                            <td colspan="6" align="center">
                                <input type="button" class="button_grv" value="Save" onclick="javascript: return validate(1);" />
                                <input type="button" class="button_grv" value="Save and continue" onclick="javascript: return validate(2);" />
                                <input type="reset" value="Reset" class="button_grv_cancel"/>
                                <input type="button" class="button_grv_cancel" value="Cancel" onClick="javascript:window.location.href='listEmpresarialDependiente.php';" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
 	</div>
</form>    
</body>
</html>

<script language="javascript" type="application/javascript">




function ajustarFinal()
{
	var total_eps = parseFloat(document.getElementById('ajusteAnt').value);
	if(document.getElementById('emde_ajuste').value != '' || document.getElementById('emde_ajuste').value != 0)
		var total_ajuste = parseFloat(document.getElementById('emde_ajuste').value);
	else
		var total_ajuste = 0;
		
	if(document.getElementById('emde_value_admission').value != '' || document.getElementById('emde_value_admission').value != 0)
		var total_admission = parseFloat(document.getElementById('emde_value_admission').value);
	else
		var total_admission = 0;		
		
	if(document.getElementById('emde_reingreso').value != '' || document.getElementById('emde_reingreso').value != 0)
		var total_reingreso = parseFloat(document.getElementById('emde_reingreso').value);
	else
		var total_reingreso = 0;
		
	if(document.getElementById('emde_otros').value != '' || document.getElementById('emde_otros').value != 0)
		var total_otros = parseFloat(document.getElementById('emde_otros').value);
	else
		var total_otros = 0;
	
	if(document.getElementById('emde_interes_mora').value != '' || document.getElementById('emde_interes_mora').value != 0)
		var total_interes = parseFloat(document.getElementById('emde_interes_mora').value);
	else
		var total_interes = 0;
		
	if(document.getElementById('emde_descuentos').value != '' || document.getElementById('emde_descuentos').value != 0)
		var total_descuentos = parseFloat(document.getElementById('emde_descuentos').value);
	else
		var total_descuentos = 0;				
		
	var total = ((total_eps + total_admission + total_ajuste + total_reingreso + total_otros + total_interes)- total_descuentos );
	
	document.getElementById('input_eps').value = total;
	
		
}

function reingresoFinal()
{
	var total_eps = parseFloat(document.getElementById('ajusteAnt').value);
	if(document.getElementById('emde_reingreso').value != '' || document.getElementById('emde_reingreso').value != 0)
		var total_reingreso = parseFloat(document.getElementById('emde_reingreso').value);
	else
		var total_reingreso = 0;
	
	var total = (total_eps + total_reingreso);
	
	document.getElementById('input_eps').value = total;
	
		
}

/*
    Si se presiona la tecla enter debe cargar una nueva fila
    para eso es necesario validar que el campo no sea vacio.
    */
    function validarEnter(e)
    {
 		var key;
		if(window.event){
			key = window.event.keyCode;   //IE
		}else
			key = e.which;                //firefox
		if (key == 13){
			//most();
		}    
    }


</script>
<?php include('divscoolmessage.php');?>